<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>投诉</title>
    <style>
        div {
            position: absolute;
            top: 30%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }
    </style>
</head>
<body>
<div>
    请输入投诉内容:<label for="content"></label>
    <textarea id="content" placeholder="请输入投诉内容"></textarea><br>
    <input type="button" id="button" value="提交"><br>
    <a href="SellerPage.jsp">返回</a>
</div>
<script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
<script>
    $(function () {
        $('#button').on('click', function () {
            $.ajax({
                url: "http://localhost:8080/complaint.do",
                type: "post",
                data: {
                    content: $('#content').val(),
                    method: 'doComplaint'
                },
                dataType: "text",
                success: function (data) {
                    if (data === 'ok') {
                        alert("投诉成功！请等待管理员处理");
                    } else {
                        alert("投诉失败");
                    }
                }
            })
        })
    })
</script>
</body>
</html>
